import AjaxForBusOpen from '@/utils/AjaxForBusOpen'
import { ajaxAsync } from 'vue-xiaobu-utils'

/**
 * 重新获取支付串------包车
 * @param {*} orderNO 订单号
 * @param {*} payment 支付方式
 */
async function getPaymentStr(orderNO, payment) {
  let postData = {
    ORDER_NO: orderNO,
    PAYMENT: payment
  }
  let res = await AjaxForBusOpen(
    '/chartered-bus-api/chartered/bus_order/get/payment',
    postData
  )
  let paymentObj = {
    payment: res.PAYMENT,
    orderNO: res.ORDER_NO,
    paymentStr: res.PAYMENT_STR
  }
  return paymentObj
}

/**
 * 获取订单支付支付串----------定制班线
 * @param {String} orderNo 订单编号
 * @param {String} payment 支付方式
 */

async function getCRPaymentStr(orderNo, payment) {
  let sendObj = {
    ORDER_ID: orderNo,
    PAYMENT: payment
  }
  let res = await ajaxAsync('order/payment', sendObj)
  return res
}

/**
 * 预约单状态查询
 * @param {*} orderNO 订单号
 */
async function getStatusInquiry(orderNO) {
  let postData = {
    ORDER_NO: orderNO
  }
  let res = await AjaxForBusOpen(
    '/chartered-bus-api/chartered/bus_order/state',
    postData
  )
  return res.STATE
}
export { getPaymentStr, getCRPaymentStr, getStatusInquiry }
